<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台用户管理</title>
    <meta name="keywords" content="PHP1611后台管理">
    <meta name="description" content="PHP1611后台管理">
    <link rel="shortcut icon" href="/Public/Admin/favicon.ico">
    <link href="/Public/Admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/font-awesome.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/Admin/css/animate.css" rel="stylesheet">
    <link href="/Public/Admin/css/style.css" rel="stylesheet">
    <link href="/Public/Admin/js/plugins/layer/skin/layer.css" rel="stylesheet">
    <link href="/Public/Admin/js/plugins/layer/laypage/skin/laypage.css" rel="stylesheet">
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>单页管理</h5>
                    <div class="ibox-tools">
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="row m-b-sm m-t-sm">
                        <div class="col-md-2">
                            <a href="<?php echo U('Page/add');?>" class="btn btn-outline btn-primary">添加单页管理</a>
                        </div>
                        <!-- <form name="group_list" id="group_list" action="<?php echo U('page/index');?>" method="get">
                        <div class="col-md-3" style="margin-top: 2px">
                            <div class="input-group">
                                <input type="text"  id="title" name="title" placeholder="请输入管理员名称" value="<?php echo ($title); ?>" class="input-sm form-control"> <span class="input-group-btn">
                                            <button type="submit" class="btn btn-sm btn-primary" id="submit"> 搜索</button> </span>
                            </div>
                        </div>
                        </form>-->
                    </div>

                    <table class="table table-bordered">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>单页名称</th>
                            <th>英文目录</th>
                            <th>外链接</th>
                            <th>排序</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="show">
                        <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$va): $mod = ($i % 2 );++$i;?><tr>
                                <td><?php echo ($va["id"]); ?></td>
                                <td><?php echo ($va["title"]); ?></td>
                                <td><?php echo ($va["name"]); ?></td>
                                <td><?php echo ($va["link"]); ?></td>
                                <td><?php echo ($va["sort"]); ?></td>
                                <td>
                                    <a href="<?php echo U("page/add");?>?id=<?php echo ($va["id"]); ?>" class="btn btn-outline btn-primary"><i class="fa fa-edit"></i> 修改</a>
                                    <a href="javascript:del(<?php echo ($va["id"]); ?>)" class="btn btn-outline btn-danger"><i class="fa fa-trash"></i> 删除</a>
                                </td>
                            </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/Public/Admin/js/jquery.min.js"></script>
<script src="/Public/Admin/js/bootstrap.min.js"></script>
<script src="/Public/Admin/js/plugins/layer/layer.js"></script>
<script src="/Public/Admin/js/plugins/layer/laypage/laypage.js"></script>
<script src="/Public/Admin/js/comment.js"></script>
<script>
    //改变用户组状态
    function changeStatus(id){
        var objectStatus = $('#show'+id);
        $.post(
                "<?php echo U('page/changeStatus');?>",
                {id:id},
                function(data){
                    if(data.status > 0){
                        layer.msg(data.msg, {icon:5, time: 1000});
                    }else{
                        if(data.data == 1){
                            objectStatus.removeClass("label-danger").addClass("label-primary").html('是');
                        }else{
                            objectStatus.removeClass("label-primary").addClass("label-danger").html('否');
                        }
                    }
                },
                'json');
    }

    //删除用户组
    function del(id)
    {
        layer.msg('你确定删除吗？',{
            time:0,
            btn:['确定','取消'],
            yes:function(index){
                $.post(
                        "<?php echo U('page/del');?>",
                        {id:id},
                        function(data){
                            if (data.status > 0) {
                                comment.error(data.msg);
                            }else{
                                comment.success(data.msg,"<?php echo U("page/index");?>")
                            }
                        }, 'json');
            }
        });
    }

</script>
</html>